<?php

namespace app\api\model;

use app\common\enums\StatusEnum;

class Slides extends \app\common\model\Slides
{
    /**
     * 幻灯片列表（全部）
     * @return false|\think\db\Query[]
     * @throws \think\Exception\DbException
     */
    public static function getList()
    {
        $model = static::field('id AS slideId, image, lang_id AS langId')
            ->where(['status' => StatusEnum::ENABLED])
            ->order(['sort_num' => 'desc', 'create_time' => 'desc'])
            ->select()
            ->toArray();
        foreach ($model as $key => $value) {
            $model[$key]['image'] = config('file_prefix') . $value['image'];
        }
        return $model;
    }
}